package com.whmall.service.crm.module.supplierchemical.service.impl;

import cn.hutool.core.util.StrUtil;
import com.whmall.service.crm.entity.dto.supplierchemical.ChemicalCoaInfoReqDTO;
import com.whmall.service.crm.entity.dto.supplierchemical.SupplierChemicalRemarkRecordReqDTO;
import org.springframework.stereotype.Component;

/**
 * Description TODO
 * Author yangkuan
 * Date 2020/9/22 16:24
 **/
@Component
public class ChemicalRemarkRecordValidator {

    public void validate(SupplierChemicalRemarkRecordReqDTO reqDTO) {

        if (StrUtil.isEmpty(reqDTO.getRemark())){
            throw new IllegalArgumentException("备注不能为空");
        }

        if (reqDTO.getIsStock() == null){
            throw new IllegalArgumentException("是否有货不能为空");
        }

        if (reqDTO.getIsStock().intValue() == 0 && reqDTO.getEstimatedAvailabilityTime() == null){
            throw new IllegalArgumentException("无货时 预计有货时间不能为空");
        }

    }

}
